import { Controller, Get, Post, Body, Patch, Param, Delete, Query, Put } from '@nestjs/common';
import { OrderService } from './order.service';
import { CreateOrderDto } from './dto/create-order.dto';
import { UpdateOrderDto } from './dto/update-order.dto';

@Controller('order')
export class OrderController {
  constructor(private readonly orderService: OrderService) {}

  // 添加订单
  @Post()
 async create(@Body() createOrderDto: CreateOrderDto) {
    return await this.orderService.create(createOrderDto);
  }

  // 获取图文问诊订单
  @Get('search')
  async getLists(@Query('paymentType') paymentType: string) {
    const data = await this.orderService.findList(paymentType);
    return data
  }

  // 根据订单号获取图文问诊订单
  @Get('search/:OrderNumber')
  findOne(@Param('OrderNumber') OrderNumber: string) {
    return this.orderService.findOne(OrderNumber);
  }

  // 根据订单号修改图文问诊订单状态
  @Put('/put/:OrderNumber')
  update(@Param('OrderNumber') OrderNumber: string, @Body() updateOrderDto: UpdateOrderDto) {
    return this.orderService.update(OrderNumber, updateOrderDto);
  }

  // @Delete(':id')
  // remove(@Param('id') id: string) {
  //   return this.orderService.remove(+id);
  // }
}
